package com.ruoyi.drug.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.drug.domain.DrugsProducer;
import com.ruoyi.drug.mapper.DrugsProducerMapper;
import com.ruoyi.drug.service.IDrugsProducerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 厂家Service业务层处理
 *
 * @author ruoyi
 * @date 2022-11-13
 */
@Service
public class DrugsProducerServiceImpl implements IDrugsProducerService
{
    @Autowired
    private DrugsProducerMapper drugsProducerMapper;

    /**
     * 查询厂家
     *
     * @param proId 厂家主键
     * @return 厂家
     */
    @Override
    public DrugsProducer selectDrugsProducerByProId(Long proId)
    {
        return drugsProducerMapper.selectDrugsProducerByProId(proId);
    }

    /**
     * 查询厂家列表
     *
     * @param drugsProducer 厂家
     * @return 厂家
     */
    @Override
    public List<DrugsProducer> selectDrugsProducerList(DrugsProducer drugsProducer)
    {
        return drugsProducerMapper.selectDrugsProducerList(drugsProducer);
    }

    /**
     * 新增厂家
     *
     * @param drugsProducer 厂家
     * @return 结果
     */
    @Override
    public int insertDrugsProducer(DrugsProducer drugsProducer)
    {
        drugsProducer.setCreateTime(DateUtils.getNowDate());
        return drugsProducerMapper.insertDrugsProducer(drugsProducer);
    }

    /**
     * 修改厂家
     *
     * @param drugsProducer 厂家
     * @return 结果
     */
    @Override
    public int updateDrugsProducer(DrugsProducer drugsProducer)
    {
        drugsProducer.setUpdateTime(DateUtils.getNowDate());
        return drugsProducerMapper.updateDrugsProducer(drugsProducer);
    }

    /**
     * 批量删除厂家
     *
     * @param proIds 需要删除的厂家主键
     * @return 结果
     */
    @Override
    public int deleteDrugsProducerByProIds(Long[] proIds)
    {
        return drugsProducerMapper.deleteDrugsProducerByProIds(proIds);
    }

    /**
     * 删除厂家信息
     *
     * @param proId 厂家主键
     * @return 结果
     */
    @Override
    public int deleteDrugsProducerByProId(Long proId)
    {
        return drugsProducerMapper.deleteDrugsProducerByProId(proId);
    }
}
